package com.wy.dao;

import com.wy.model.sys.DeviceEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.security.core.parameters.P;

import java.util.List;

@Mapper
public interface DeviceEntityMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(DeviceEntity record);

    int insertSelective(DeviceEntity record);

    DeviceEntity selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(DeviceEntity record);

    int updateByPrimaryKey(DeviceEntity record);

    public List<DeviceEntity> deviceList(@Param("pageSize") Integer pageSize, @Param("start") Integer start,
                                         @Param("residenceId") Integer residenceId, @Param("deviceName") String deviceName,
                                         @Param("rids")List<String> rids);

    public Integer deviceSize(@Param("pageSize") Integer pageSize, @Param("start") Integer start,
                              @Param("residenceId") Integer residenceId,@Param("deviceName") String deviceName,
                              @Param("rids")List<String> rids);


    void deleteDevices(@Param("groupId")List<String> groupId);

    void insertBatch(List<DeviceEntity> list);

    /**
     * 根据名称获取设备
     * @return
     */
    List<DeviceEntity> getDeviceByName(@Param("residenceId") Integer residenceId,@Param("deviceName") String deviceName);

    /**
     * 根据ip地址获取
     * @return
     */
    List<DeviceEntity> getDeviceByAddress(@Param("residenceId") Integer residenceId,@Param("deviceAddress") String deviceAddress,@Param("deviceChannelId") String deviceChannelId);

    /**
     * 根据小区id获取设备列表
     * @param rid
     * @return
     */
    List<DeviceEntity> getDeviceByRid(@Param("rid") Integer rid);
    /**
     * 根据小区id获取设备列表
     * @param rid
     * @return
     */
    List<DeviceEntity> getDeviceByRidAndType(@Param("rid") Integer rid, @Param("type") Integer type);


}